// 导入requset请求
import requsetVue2 from '@/utils/requsetVue2'

/**
 * @desc 登录接口
 * @returns Promise
 */

// 定义data类型

export interface LoginModel {
  name: string
  nickName: string
  token: string
}
export const loginData = (data: any) => {
  return requsetVue2.post<any, LoginModel>('/api/user/passport/login', data)
}

/**
 * @desc 获取用户信息
 * @returns Promise
 */

// 定义获取用户信息的接口数据类型
export interface userInfoModel {
  id: number
  loginName: string
  nickName: string
  passwd: string
  name: string
  phoneNum: string
  email: null
  headImg: string
  userLevel: string
  status: number
  birthday: null
  gender: string
  createTime: string
  operateTime: string
  openId: null
}
export const reqUserInfo = () => {
  return requsetVue2.get<any, userInfoModel>('/api/user/passport/auth/getUserInfo')
}

/**
 * @desc 退出登录
 * @returns Promise
 */
export const reqPassport = () => {
  return requsetVue2.get('/api/user/passport/logout')
}
